<head>
<style type="text/css">
#example td:nth-child(6){
	text-align: center;
}
#example td:nth-child(7){
	text-align: center;
}
#example td:nth-child(2){
	text-align: center;
}
#example td:nth-child(10){
	text-align: center;
}
#example td:nth-child(11){
	text-align: right;
}
#example td:nth-child(14){
	text-align: center;
}
</style>
	<script type="text/javascript">
		var aJaxURL	= "server-side/sale/elva.ge.action.php";	//server side folder url
		var tName	= "example";											//table name

		$(document).ready(function () {

			

			GetDate("search_start");
			GetDate("search_end");
					
			
			var start 	= $("#search_start").val();
			var end 	= $("#search_end").val();
			GetButtons("","delete_id");
			LoadTable(start,end);
			SetEvents('','delete_id','check-all-in',tName,'in_page',aJaxURL);
			
		});

		function LoadDialog(fname){
			
			GetDialog("in_page","1170","auto");
			GetDate("oder_date");
			$(".download").button({
	            
		    });
			 $("#save-dialog").on("click",function(){
				
				param = new Object();
				param.act = "save_dialog";

				// elva.ge
				param.id=$("#id").val();
				param.oder_date=$("#oder_date").val();
				param.status=$("#status").val();
				param.cooradinator=$("#cooradinator").val();
				param.k_coment=$("#k_coment").val();
				param.elva=$("#elva").val();

				// all user
				param.person_id		=$("#person_id").val();
				param.name_surname	=$("#name_surname").val();
				param.mail			=$("#mail").val();
				param.phone			=$("#phone").val();
				param.phone1		=$("#phone1").val();
				param.addres		=$("#addres").val();
				param.period		=$("#period").val();
				param.book			=$("#book").val();
				param.date			=$("#date").val();
				param.op_id			=$("#op_id").val();
				param.sum_price		=$("#sum_price").val();
				param.c_coment		=$("#c_coment").val();

				$.getJSON(
					aJaxURL, param, function(data) {
						var start 	= $("#search_start").val();
						var end 	= $("#search_end").val();
						LoadTable(start, end);
					});
				$('#'+fname).dialog("close");
				});
			 
			} ;
		function LoadTable(start, end){
			var total=[6];
			/* Table ID, aJaxURL, Action, Colum Number, Custom Request, Hidden Colum, Menu Array */
			GetDataTableReload(tName, aJaxURL, "get_list", 16, "start=" + start + "&end=" + end, 0, "", 0, "desc", total);
		}

		$(document).on("change", "#search_start", function () {
	    	var start	= $(this).val();
	    	var end		= $("#search_end").val();
	    	LoadTable(start, end);
	    });
	    
	    $(document).on("change", "#search_end", function () {
	    	var start	= $("#search_start").val();
	    	var end		= $(this).val();
	    	LoadTable(start, end);
	    });

	    $(document).on("click", ".delete_prod", function () {
		    var delete_prod_id = $(this).val();
		    var evla_id = $("#id").val();
		    $.getJSON(
					aJaxURL,
					"act=delete_prod&delete_prod_id="+delete_prod_id+"&evla_id="+evla_id,
					function(data) {
						 $("#sell_prod").html(data.page);
					});

	    });

	    $(document).on("click", ".delete_gift", function () {
		    var delete_gift_id = $(this).val();
		    var evla_id = $("#id").val();
		    $.getJSON(
					aJaxURL,
					"act=delete_gift&delete_gift_id="+delete_gift_id+"&evla_id="+evla_id,
					function(data) {
						 $("#sell_gift").html(data.page);
					});
	    });
	    
	    $(document).on("click", ".download", function () {
            var link = $(this).attr("str");
            link = "http://109.234.117.182:8181/records/" + link;

            var newWin = window.open(link, "JSSite", "width=420,height=230,resizable=yes,scrollbars=yes,status=yes");
            newWin.focus();
        });

    </script>
    <style type="text/css">

    </style>
</head>

<body>
    <div id="dt_example" class="ex_highlight_row">
    <h2 style="position: absolute; top: 80px; margin-left: 50%;">გაყიდვები</h2>
        <div id="container" style="width: 100%; margin-top: 70px;"  >
            <div id="dynamic" style="width: 100%; ">
            <div id="button_area" style="position: fixed; top: 80px;">
	            	<div class="left" style="width: 175px;">
	            		<label for="search_start" class="left" style="margin: 5px 0 0 9px;">დასაწყისი</label>
	            		<input style="width: 80px; height: 16px; margin-left: 5px;" type="text" name="search_start" id="search_start" class="inpt left"/>
	            	</div>
	            	<div class="left" style="">
	            		<label for="search_end" class="left" style="margin: 5px 0 0 9px;">დასასრული</label>
	            		<input style="width: 80px; height: 16px; margin-left: 5px;" type="text" name="search_end" id="search_end" class="inpt right" />
            		</div>
            		<button id="delete_id" class="right">წაშლა</button>	
            	</div>
                <table class="display" id="example" >
                    <thead>
                        <tr id="datatable_header" class="search_header">
                        	<th style="">id</th>
							<th style="width: 50%">სახელი და გვარი</th>
							<th style="width: 50%">ტელეფონი 1</th>
							<th style="width: 50%">ტელეფონი 2</th>
							<th style="width: 50%">პერიოდი</th>
							<th style="width: 50%">გამოცემა</th>
							<th style="width: 50%">გადასახდელი თანხა</th>
							<th style="width: 50%">ქოლცენტრის კომენტარი</th>
							<th style="width: 50%">ოპერატორი</th>
							<th style="width: 50%">სტატუსი</th>
							<th style="width: 50%">კოორდინატორი</th>
							<th style="width: 50%">კოოდინატორის შენიშვნა</th>
							<th style="width: 50%">ნინო (ელვა)</th>
							<th style="width: 30px">#</th>
                        </tr>
                      </thead>
					  <thead>
                        <tr>
                            <th class="colum_hidden">
                            	<input type="text" name="search_id" value="ფილტრი" class="search_init"/>
                            </th>
                            
                            <th>
                                <input type="text" name="search_date" value="ფილტრი" class="search_init"/>
                            </th>
                            
                            <th>
                                <input type="text" name="search_date" value="ფილტრი" class="search_init" />
                            </th>
                            <th>
                                <input type="text" name="search_phone" value="ფილტრი" class="search_init" />
                            </th>
                            <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init" />
                            </th>
                             <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init" />
                            </th>
                            <th>
                                <input type="text" name="search_phone" value="ფილტრი" class="search_init"/>
                            </th>
                            <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init" />
                            </th>
                            <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init"/>
                            </th>
                            <th>
                                <input type="text" name="search_phone" value="ფილტრი" class="search_init"/>
                            </th>
                            <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init"  />
                            </th>
                            <th>
                                <input type="text" name="search_category" value="ფილტრი" class="search_init"  />
                            </th>
                            <th>
                                <input type="text" name="search_phone" value="ფილტრი" class="search_init"/>
                            </th>
                            <th>
								<input type="checkbox" name="check-all" id="check-all-in"/>
							</th>

                        </tr>
                    </thead>
                    <tfoot>
                        <tr id="datatable_header" class="search_header">
							<th style="width: 150px"></th>							
							<th style="width: 150px"></th>
							<th style="width: 150px"></th>
							<th style="width: 150px"></th>
							<th style="width: 150px"></th>
							<th style="width: 150px; text-align: right;">ჯამი :<br>სულ :</th>
							<th style="width: 150px; text-align: right;"></th>
							<th style="width: 150px"></th>
							<th style="width: 150px"></th>
							<th style="width: 150px"></th>
							<th style="width: 150px"></th>
							<th style="width: 150px"></th>
							<th style="width: 150px"></th>
							<th style="width: 150px"></th>
                        </tr>
                        </tfoot>
                </table>
            </div>
            <div class="spacer">
            </div>
        </div>
    </div>
<div id='in_page' class="form-dialog"></div>
    </body>
